/***
 * JAVANAISE API
 * Contact: 
 *
 * Authors: 
 */

package jvn.client.interfaces;

import java.io.*;

import jvn.client.JvnException;

/**
 * Interface of a JVN object. The serializable property is required in order to be able to transfer a reference to a JVN
 * object remotely
 */

public interface JvnObjectI extends Serializable {

	/**
	 * Get a Read lock on the object
	 * 
	 * @throws JvnException
	 **/
	public void jvnLockRead() throws jvn.client.JvnException;

	/**
	 * Get a Write lock on the object
	 * 
	 * @throws JvnException
	 **/
	public void jvnLockWrite() throws jvn.client.JvnException;

	/**
	 * Unlock the object
	 * 
	 * @throws JvnException
	 **/
	public void jvnUnLock() throws jvn.client.JvnException;

	/**
	 * Get the object identification
	 * 
	 * @throws JvnException
	 **/
	public int jvnGetObjectId() throws jvn.client.JvnException;

	/**
	 * Get the object state
	 * 
	 * @throws JvnException
	 **/
	public Serializable jvnGetObjectState() throws jvn.client.JvnException;

	/**
	 * Invalidate the Read lock of the JVN object
	 * 
	 * @throws JvnException
	 **/
	public void jvnInvalidateReader() throws jvn.client.JvnException;

	/**
	 * Invalidate the Write lock of the JVN object
	 * 
	 * @return the current JVN object state
	 * @throws JvnException
	 **/
	public Serializable jvnInvalidateWriter() throws jvn.client.JvnException;

	/**
	 * Reduce the Write lock of the JVN object
	 * 
	 * @return the current JVN object state
	 * @throws JvnException
	 **/
	public Serializable jvnInvalidateWriterForReader() throws jvn.client.JvnException;

	/**
	 * Associe un nouveau état a l'objet (état = contenu).
	 * 
	 * @param jvnInvalidateWriterForReader
	 *            le nouveau contenu.
	 * @throws jvn.client.JvnException
	 */
	public void jvnSetObjectState(Serializable jvnInvalidateWriterForReader) throws jvn.client.JvnException;
}
